package com.nbjtjc.safe.api.report;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.service.report.EmgReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @auther guqianbin
 * @date 2018/4/23 17:59
 * 应急处置的导入导出
 **/
@RestController
@RequestMapping("/report")
@CrossOrigin("*")
public class EmgReportController {

    @Autowired
    private EmgReportService emgReportService;



    @GetMapping("/emgReportFileList/{planPublicId}")
    public Result emgReportFileList(@PathVariable("planPublicId")  int planPublicId){
        Result result=emgReportService.emgReportFileList(planPublicId);
        return result;
    }

    @GetMapping("/emgPlanPublicExcel/{planPublicId}")
    public void emgPlanPublicExcel(HttpServletResponse response,@PathVariable("planPublicId") int planPublicId) throws IOException {
        emgReportService.emgPlanPublicsExcel(response,planPublicId);
    }

    /**
     *
     * @param planPublicId
     * @param response
     */
    @SysLog("下载工作简报的报表")
    @GetMapping("/emgWorkBrief/{planPublicId}/{companyId}")
    public void workBrief(@PathVariable("planPublicId") int planPublicId
            ,@PathVariable("companyId") int companyId
            , HttpServletResponse response) {
        emgReportService.emgWorkBriefExcel(response,planPublicId,companyId);
    }

    /**
     *
     * @param planPublicId
     * @param response
     */
    @SysLog("下载应急响应的工作总结的报表")
    @GetMapping("/emgSummary/{planPublicId}/{companyId}")
    public void emgSummary(@PathVariable("planPublicId") int planPublicId
            ,@PathVariable("companyId") int companyId
            , HttpServletResponse response) {
        emgReportService.emgSummaryExcel(response,planPublicId,companyId);
    }


    /**
     *
     * @param planPublicId
     * @param response
     */
    @SysLog("下载应急响应的关联的物资的报表")
    @GetMapping("/emgPlanGoods/{planPublicId}")
    public void emgPlanGoods(@PathVariable("planPublicId") int planPublicId, HttpServletResponse response) {
        emgReportService.emgPlanGoodsExcel(response,planPublicId);
    }

    /**
     *
     * @param eventId
     * @param response
     */
    @SysLog("下载应急事件的重大事件上报的报表")
    @GetMapping("/emgHandleReport/{eventId}")
    public void emgHandleReportExcel(@PathVariable("eventId") int eventId, HttpServletResponse response) {
        emgReportService.emgReportExcel(response,eventId);
    }
}
